package net.ru.topdog.lunchy.main;

import java.util.ArrayList;
import java.util.List;

import net.ru.topdog.lunchy.Dish;

public class MainModel implements MainModelInterface {
	public boolean  activity;
	
	List<MainViewObserverInterface> observers = new ArrayList<MainViewObserverInterface>();

@Override
	public void registerMainViewObserver(MainViewObserverInterface o) {
		observers.add(o);
		
	}

	
@Override
	public void removeMainViewObserver(MainViewObserverInterface o) {
		int i = observers.indexOf(o);
		if (i>=0){
			observers.remove(i);
		}
	}
	
	public void notifyMainViewObservers(){
		for(MainViewObserverInterface observer:observers){
			observer.updateMainView();
		}
	}


	public boolean isActivity() {
		return activity;
	}


	public void setActivity(boolean activity) {
		this.activity = activity;
		notifyMainViewObservers();
	}

}
